package cn.luowb.checkchat.controller;

import cn.luowb.checkchat.common.result.Result;
import cn.luowb.checkchat.common.web.Results;
import cn.luowb.checkchat.dao.entity.CategoryDO;
import cn.luowb.checkchat.dto.resp.CategoryHotVO;
import cn.luowb.checkchat.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/public/categorys")
public class CategoryController {
    @Autowired
    public CategoryService categoryService;

    @GetMapping
    public Result<List<CategoryDO>> list(){
        List<CategoryDO> list = categoryService.list();
        return Results.success(list);
    }

    @GetMapping("/hot")
    public Result<List<CategoryHotVO> > hot(){
        List<CategoryHotVO> list = categoryService.getHot();
        return Results.success(list);
    }
}
